var t = require("../../utils/api.js"), e = getApp();

Page({
    data: {},
    onLoad: function(o) {
        var a = this, n = getCurrentPages(), i = (n[n.length - 1], n[n.length - 2]), d = i.data.info;
        console.log(i.data);
        for (var s = 0; s < d.length; s++) if (o.id == d[s].lid) var l = d[s];
        console.log(o), t.GetHeadSendGoodsList({
            openid: e.globalData.openid,
            lid: o.id
        }).then(function(t) {
            console.log(t), a.setData({
                goodsinfo: t.data.data,
                no_goodsinfo: t.data.data_no_get,
                lid: o.id,
                has_get: o.type,
                time: o.time,
                info: l
            });
        });
    },
    comfirm: function(o) {
        var a = this, n = o.currentTarget.dataset.lid;
        console.log(n), t.HeadSureSendOrderList({
            openid: e.globalData.openid,
            lid: n
        }).then(function(t) {
            console.log(t), 1 == t.errno ? wx.showToast({
                title: "还有未发货商品，无法确认收货",
                duration: 2e3,
                icon: "none"
            }) : (wx.showToast({
                title: t.message,
                duration: 2e3,
                icon: "none"
            }), setTimeout(function() {
                wx.navigateBack({
                    delta: 1
                });
            }, 2e3), a.setData({
                has_get: !0
            }));
        });
    }
});